package com.csun.cmny.provider.dao;

import com.csun.cmny.provider.dto.OldmanQueryDto;
import com.csun.cmny.provider.model.dto.*;
import com.csun.cmny.provider.model.dto.customerArchives.OldmanArchivesQueryDto;
import com.csun.cmny.provider.model.dto.message.OldmanInQueryDto;
import com.csun.cmny.provider.model.vo.*;
import com.csun.cmny.provider.model.vo.customerArchives.OldmanArchivesListVo;
import com.csun.cmny.provider.model.vo.message.OldmanInVo;
import com.csun.cmny.provider.pojo.Oldman;
import com.csun.cmny.provider.vo.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface OldmanMapper {
    int deleteByPrimaryKey(Integer oldmanId);

    int insert(Oldman record);

    int insertSelective(Oldman record);

    Oldman selectByPrimaryKey(Integer oldmanId);

    int updateByPrimaryKeySelective(Oldman record);

    int updateByPrimaryKey(Oldman record);
    /**
     * 查询老人
     * author:liqian
     * date:2018-11-06 14:08
     */
    Oldman selectByOld(Oldman oldman);

    Oldman selectDescByOld(Oldman oldman);
    /**
     * 根据条件查询社区老人
     * author:liqian
     * date:2018-11-06 14:35
     */
    List<Map<String,Object>> showAll(Map<String,Object> queryMap);
    List<Map<String,Object>> showIn(Map<String,Object> queryMap);
    Oldman checkOldmanbelong(OldmanRpcDto oldmanRpcDto);

    /**
     * query oldman address
     *
     * @param oldmanAddressQueryDto oldman address query dto
     *
     * @return  the list.
     */
    List<OldmanAddressVo> queryOldmanAddress(OldmanAddressQueryDto oldmanAddressQueryDto);

    /**
     * query oldman not bind watch list
     *
     * @param oldmanNotBindWatchQueryDto    oldman not bind watch query dto
     *
     * @return  the list.
     */
    List<OldmanNotBindWatchVo> queryOldmanNotBindWatchList(OldmanNotBindWatchQueryDto oldmanNotBindWatchQueryDto);

    /**
     * query oldman bed room building list all
     *
     * @param oldmanIdList oldman id list
     *
     * @return the list.
     */
    List<OldmanBedRoomBuildingVo> queryOldmanBedRoomBuildingList(@Param("oldmanIdList") List<Integer> oldmanIdList);

    /**
     * query bed room building oldman list
     *
     * @param bedIdList bed id list
     *
     * @return the list.
     */
    List<OldmanBedRoomBuildingVo> queryBedRoomBuildingOldmanList(@Param("bedIdList") List<Integer> bedIdList);

    /**
     * query bed room building oldman list by room id
     *
     * @param roomId room id
     *
     * @return the list.
     */
    List<OldmanBedRoomBuildingVo> queryBedRoomBuildingOldmanListByRoomId(Integer roomId);

    List<Oldman> selectSelective(Oldman oldman);

    /**
     * query oldman bed room building by oldman id
     *
     * @param oldmanId
     * @return
     */
    OldmanBedRoomBuildingVo queryOldmanBedRoomBuildingByOldmanId(Integer oldmanId);

    /**
     * query oldman bed room building by bed id
     *
     * @param bedId
     * @return
     */
    OldmanBedRoomBuildingVo queryOldmanBedRoomBuildingByBedId(Integer bedId);


    //根据日期查询老人生日
    List<OldManVo> queryOldManBirthdayByDay(Map<String,Object> queryParam);

    //根据月份查询老人生日
    List<OldManVo> queryOldManBirthdayByMonth(Map<String,Object> queryParam);

    //在住老人、试住老人数量——首页
    List<Integer> oldManNumberList(@Param("groupId") Long groupId);

    //今日预约（咨询）、今日试住、今日外出（请假）——首页
    List<Integer> todayList(@Param("groupId") Long groupId,@Param("date") String thisDate);

    //查询老人一周生日
    List<OldManVo> selectByWeek(Map<String, Object> queryParam);

    //根据ID查询老人的信息及其额外信息
    OldManSupVo selectOldManSupByOld(Oldman oldman);

    //查询老人信息及其额外信息列表
    List<OldManSupVo> selectOldManSup(Oldman oldman);

    //老人及额外信息查询所有
    List<OldManSupVo> showOldManSupAll(Map<String, Object> queryParam);

    //老人及额外信息查询所有（待评估，待缴费，已入院）
    List<OldManSupVo> showOldManSupIn(Map<String, Object> queryParam);

    /**
     * 根据姓名模糊查询老人信息--现在评估模块使用
     * @param omcOldManDto
     * @return
     */
    List<CacOldManVo> showCacOldMan(OmcOldManDto omcOldManDto);

    /**
     * 查询身份证是否重复
     * @param queryMap
     * @return
     */
    Integer queryIdCardRepet(Map<String, Object> queryMap);


    /**
     * 按性别统计老人数量
     * @param: [groupId]
     * @return: java.util.Map<java.lang.String,java.lang.Object>
     */
    List<Map<String,Object>> countOldmanNumGroupBySex(@Param("groupId") Long groupId);

    /**
     * 按人员类别统计老人数量
     * @param: [groupId]
     * @return: java.util.Map<java.lang.String,java.lang.Object>
     */
    List<Map<String, Object>> countOldmanNumGroupByPeopleType(@Param("groupId") Long groupId);

    /**
     * 按年龄统计老人数量
     * @param: [groupId]
     * @return: java.util.Map<java.lang.String,java.lang.Object>
     */
    List<Map<String, Object>> countOldmanNumGroupByAge(@Param("groupId") Long groupId);

    /**
     * 查询机查询老人信息
     * @param: [oldmanId]
     * @return: com.csun.cmny.provider.model.vo.QueryMachineOldInfoVo
     */
    QueryMachineOldInfoVo getOldmanInfoByOldmanId(@Param("oldmanId") Long oldmanId);

    /**
     * 查询机查询老人列表
     * @param: [oldmanQueryDto]
     * @return: java.util.List<com.csun.cmny.provider.vo.QueryMachineOldmanVo>
     */
    List<QueryMachineOldmanVo> queryOldmanList(OldmanQueryDto oldmanQueryDto);

    /**
     * 根据老人id集合查询老人信息
     * @param: [oldmanIdList]
     * @return: java.util.List<com.csun.cmny.provider.vo.OldManVo>
     */
    List<OldManVo> queryOldmanListByIdList(@Param("oldmanIdList") List<Long> oldmanIdList);

    /**
     * 查询老人Id集合
     * @param: [groupId]
     * @return: java.util.List<java.lang.Integer>
     */
    List<Integer> queryInOldmanIdList(@Param("groupId") Long groupId);

    /**
     * 老人出院专用
     *
     * 根据老人Id更新老人状态以及清除老人所在机构
     *
     * @param oldman
     *
     * @return
     */
    Integer checkOut(Oldman oldman);

    /**
     * 查询入院待办事项
     * @param: [queryDto]
     * @return: java.util.List<com.csun.cmny.provider.model.vo.message.OldmanInVo>
     */
    List<OldmanInVo> queryOldmanInCurTaskList(OldmanInQueryDto queryDto);

    /**
     * 查询超过六个月未评估老人的信息
     * @param: [oldmanIdList]
     * @return: java.util.List<com.csun.cmny.provider.model.vo.message.OldmanInVo>
     */
    List<OldmanInVo> queryNeedDailyEvaluateOldmanList(@Param("oldmanIdList") List<Integer> oldmanIdList);

    /**
     * 根据老人状态查询老人
     * @param: [oldmanInQueryDto]
     * @return:  List<Map<String,Object>>
     */
    List<OldmanRpcVo> queryOldmanByGroupIdAndStatusList(OldmanInQueryDto oldmanInQueryDto);

    /**
     * 根据护理级别查询老人数量
     * @param: [groupId]
     * @return:  List<Map<String,Object>>
     */
    List<Map<String,Object>> countOldmanNumByServiceType(Long groupId);

    /**
     * query oldman bed room building vo by room no and bed no
     *
     * @param roomNo the room no
     * @param bedNo  the bed no
     *
     * @return the oldman bed room building vo
     */
    OldmanBedRoomBuildingVo queryOldmanBedRoomBuildingByRoomNoAndBedNo(@Param("roomNo") String roomNo,
                                                                       @Param("bedNo") String bedNo);
    List<Oldman> selectByNo(Oldman oldman);

    List<OldmanArchivesListVo> selectQueryOldman(OldmanArchivesQueryDto oldmanArchivesQueryDto);

    Oldman select(Oldman old);

    /*
    * 分页查询
    * */
    List<OldManSupVo> listPage(com.csun.cmny.provider.model.dto.OldmanQueryDto oldmanQueryDto);

    List<OldManSupVo> selectOldManByExcel(OldManSelectDto oldManSelectDto);
    /*
     * 大数据平台注册用户占比查询
     * */
    RegisterVo selectByGroup(@Param("groupIdList") List<Long> groupIdList);
    /*
     * 大数据平台健康占比亚健康展示
     * */
    HealthVo selectByHealth(@Param("groupIdList") List<Long> groupIdList);

    //机构下查询服务名
    List<GroupServiceVo> selectServiceByPid(@Param("groupIdList") List<Long> groupIdList);

    //查询居家签约老人总数
    ServiceOrderVo selectOldmanInHome(@Param("groupIdList") List<Long> groupIdList);

    //查询服务工单总数以及服务项目占比
    Map<String,Number> selectByService(@Param("groupServiceVos") List<GroupServiceVo> groupServiceVos,
                                       @Param("groupIdList") List<Long> groupIdList);
    /*
     * 大数据平台居家养老服务展示
     * */
    List<OlderNumVo> selectOldmanByNurseHome(@Param("year") Integer year,@Param("groupIdList") List<Long> groupIdList);
    /*
     * 大数据平台居家养老服务展示-居家服务数据
     * */
    List<Map<String,Number>> selectServiceByNurseHome(@Param("groupServiceVos") List<GroupServiceVo> groupServiceVos,
                                                      @Param("groupId") Long groupId,
                                                      @Param("groupIdList") List<Long> groupIdList);
    /*
     * 集团化查询老人信息
     * */
    List<OldManSupVo> selectAllOldman(@Param("oldManSupVo") OldManSupVo oldManSupVo, @Param("groupIdList") List<Long> groupIdList);
    /*
     * 老人咨询查询
     * */
    List<OldmanAdvisoryVo> selectAdvisory(@Param("oldmanAdvisoryVo") OldmanAdvisoryVo oldmanAdvisoryVo,@Param("groupIdList") List<Long> groupIdList);
    /**
     * 查询首页老人分类占比
     * @return Wrapper
     * @author HD
     * @date 2021/11/26 13:54
     */
    OldmanIndexVo selectOldmanIndex(Long groupId);
}